package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TXcyzTemp;
import com.ruoyi.system.service.ITXcyzTempService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 压装机工单临时任务 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-02-22
 */
@Controller
@RequestMapping("/system/tXcyzTemp")
public class TXcyzTempController extends BaseController
{
    private String prefix = "system/tXcyzTemp";
	
	@Autowired
	private ITXcyzTempService tXcyzTempService;
	
	@RequiresPermissions("system:tXcyzTemp:view")
	@GetMapping()
	public String tXcyzTemp()
	{
	    return prefix + "/tXcyzTemp";
	}
	
	/**
	 * 查询压装机工单临时任务列表
	 */
	@RequiresPermissions("system:tXcyzTemp:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(TXcyzTemp tXcyzTemp)
	{
		startPage();
        List<TXcyzTemp> list = tXcyzTempService.selectTXcyzTempList(tXcyzTemp);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出压装机工单临时任务列表
	 */
	@RequiresPermissions("system:tXcyzTemp:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TXcyzTemp tXcyzTemp)
    {
    	List<TXcyzTemp> list = tXcyzTempService.selectTXcyzTempList(tXcyzTemp);
        ExcelUtil<TXcyzTemp> util = new ExcelUtil<TXcyzTemp>(TXcyzTemp.class);
        return util.exportExcel(list, "tXcyzTemp");
    }
	
	/**
	 * 新增压装机工单临时任务
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存压装机工单临时任务
	 */
	@RequiresPermissions("system:tXcyzTemp:add")
	@Log(title = "压装机工单临时任务", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(TXcyzTemp tXcyzTemp)
	{		
		return toAjax(tXcyzTempService.insertTXcyzTemp(tXcyzTemp));
	}

	/**
	 * 修改压装机工单临时任务
	 */
	@GetMapping("/edit/{id}")
	public String edit(@PathVariable("id") String id, ModelMap mmap)
	{
		TXcyzTemp tXcyzTemp = tXcyzTempService.selectTXcyzTempById(id);
		mmap.put("tXcyzTemp", tXcyzTemp);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存压装机工单临时任务
	 */
	@RequiresPermissions("system:tXcyzTemp:edit")
	@Log(title = "压装机工单临时任务", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(TXcyzTemp tXcyzTemp)
	{		
		return toAjax(tXcyzTempService.updateTXcyzTemp(tXcyzTemp));
	}
	
	/**
	 * 删除压装机工单临时任务
	 */
	@RequiresPermissions("system:tXcyzTemp:remove")
	@Log(title = "压装机工单临时任务", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(tXcyzTempService.deleteTXcyzTempByIds(ids));
	}
	
}
